home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / aztecnos.arc / UDPCMD.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-19  |  1.0 KB  |  51 lines

  1. /* UDP-related user commands */
  2. #include <stdio.h>
  3. #include "global.h"
  4. #include "mbuf.h"
  5. #include "netuser.h"
  6. #include "udp.h"
  7. #include "internet.h"
  8. #include "cmdparse.h"
  9.  
  10. extern struct udp_stat Udp_stat;
  11. char *pinet();
  12. int doudpstat();
  13.  
  14. struct cmds Udpcmds[] = {
  15.     "status",    doudpstat,    0, 0,    NULLCHAR,
  16.     NULLCHAR,    NULLFP,        0, 0,"udp subcommands: status",
  17. };
  18.  
  19. doudp(argc,argv)
  20. int argc;
  21. char *argv[];
  22. {
  23.     return subcmd(Udpcmds,argc,argv);
  24. }
  25. /* Dump UDP statistics and control blocks */
  26. doudpstat()
  27. {
  28.     register struct udp_cb *udp;
  29.     register int i;
  30.  
  31.     printf("sent %u rcvd %u bdcsts %u cksum err %u unknown socket %u\n",
  32.     Udp_stat.sent,Udp_stat.rcvd,Udp_stat.bdcsts,Udp_stat.cksum,Udp_stat.unknown);
  33.     printf("    &UCB Rcv-Q  Local socket\n");
  34.     for(i=0;i<NUDP;i++){
  35.         for(udp = Udps[i];udp != NULLUDP; udp = udp->next){
  36.             st_udp(udp,1);
  37.         }
  38.     }
  39. }
  40. st_udp(udp,n)
  41. struct udp_cb *udp;
  42. int n;
  43. {
  44.     if(n == 0)
  45.         printf("    &UCB Rcv-Q  Local socket\n");
  46.  
  47.     printf("%8lx%6u  %s\n",ptol(udp),udp->rcvcnt,
  48.      pinet(&udp->socket));
  49.  
  50. }
  51.